// backend/models/studentClub/studentClub.js

const { DataTypes } = require('sequelize');
const sequelize = require('../../config/database');

// 定义 student_club 模型
const StudentClub = sequelize.define('StudentClub', {
  id: {
    type: DataTypes.INTEGER,
    autoIncrement: true,
    primaryKey: true
  },
  student_id: {
    type: DataTypes.INTEGER,
    allowNull: false,
    comment: '学生ID'
  },
  club_id: {
    type: DataTypes.INTEGER,
    allowNull: false,
    comment: '社团ID'
  },
  status: {
    type: DataTypes.ENUM('pending', 'approved', 'rejected'),
    allowNull: false,
    defaultValue: 'pending',
    comment: '申请状态：待审核、已通过、已拒绝'
  },
  apply_time: {
    type: DataTypes.DATE,
    defaultValue: DataTypes.NOW,
    comment: '申请时间'
  },
  approve_time: {
    type: DataTypes.DATE,
    allowNull: true,
    comment: '审核通过时间'
  }
}, {
  tableName: 'student_club',
  timestamps: false
});

module.exports = StudentClub;
